home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / BUS / TMCM Software and Labs.sit / Software for TMCM 7_95 / Files for Lab 13 / Circles < prev    next >
Text File  |  1995-07-08  |  1KB  |  34 lines

  1. {
  2.   A program that illustrates multiple levels of 
  3.   forking.  One turtle splits into 10, then each
  4.   of those 10 turtles splits into 10.  This gives
  5.   a total of 100 turtles.  Each turtle draws a
  6.   circle. 
  7. }
  8.  
  9.  
  10. PenUp
  11. MoveTo(-5,-5)
  12.  
  13. fork(10)            { Split into 10 turtles. }
  14. declare row         { Each turtle creates its OWN variable named "row" }
  15. row := ForkNumber   { Save the value of ForkNumber in row. }
  16.  
  17. fork(10)            { Each turtle splits into 10 new turtles. }
  18. declare column      { Each of the 100 turtles has a "column" variable, }
  19. column := ForkNumber      { which is set equal to ForkNumber. }
  20.                     { Note:  The variable column is not really }
  21.                     {        necessary, since ForkNumber could be }
  22.                     {        used directly.  I am using column only }
  23.                     {        for readability. }
  24.  
  25.  
  26. forward(column)     { Turtles spread out along a horizontal line. }
  27. face(90)
  28. forward(row)        { Turtles spread out along a vertical line. }
  29.  
  30. PenDown
  31.  
  32. circle(1)           { Each of the 100 turtled draws a circle }
  33.                     { of radius 1. }
  34.